﻿<MCard>
    <MCardTitle Class="text-h5 font-weight-regular blue-grey white--text">
        Profile
    </MCardTitle>
    <MCardText>
        <MSubheader Class="pa-0">
            Where do you live?
        </MSubheader>
        <MAutocomplete @bind-Value="_model"
                       Hint="@(!_isEditing ? "Click the icon to edit" : "Click the icon to save")"
                       Items="_states"
                       Readonly="!_isEditing"
                       Label="@($"State — {(_isEditing ? "Editable" : "Readonly")}")"
                       PersistentHint
                       ItemValue="r=>r"
                       ItemText="r=>r"
                       PrependIcon="mdi-city">
            <AppendOuterContent>
                <SlideXReverseTransition>
                    <MIcon key="@($"icon-{_isEditing}")"
                           Color="@(_isEditing ? "success" : "info")"
                           OnClick="()=>_isEditing = !_isEditing">
                        @(_isEditing ? "mdi-check-outline" : "mdi-circle-edit-outline")
                    </MIcon>
                </SlideXReverseTransition>
            </AppendOuterContent>
        </MAutocomplete>
    </MCardText>
</MCard>

@code{
    private bool _isEditing;
    private string _model;
     private List<string> _states = new List<string>()
    {
        "Alabama", "Alaska", "American Samoa", "Arizona",
        "Arkansas", "California", "Colorado", "Connecticut",
        "Delaware", "District of Columbia", "Federated States of Micronesia",
        "Florida", "Georgia", "Guam", "Hawaii", "Idaho",
        "Illinois", "Indiana", "Iowa", "Kansas", "Kentucky",
        "Louisiana", "Maine", "Marshall Islands", "Maryland",
        "Massachusetts", "Michigan", "Minnesota", "Mississippi",
        "Missouri", "Montana", "Nebraska", "Nevada",
        "New Hampshire", "New Jersey", "New Mexico", "New York",
        "North Carolina", "North Dakota", "Northern Mariana Islands", "Ohio",
        "Oklahoma", "Oregon", "Palau", "Pennsylvania", "Puerto Rico",
        "Rhode Island", "South Carolina", "South Dakota", "Tennessee",
        "Texas", "Utah", "Vermont", "Virgin Island", "Virginia",
        "Washington", "West Virginia", "Wisconsin", "Wyoming"
    };
}